﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices.WindowsRuntime;
using UnityEngine;

namespace HurricanePackage
{
    public  class UIRootConfig :BasicView
    {
        [Header("UIRoot类型")]
        public UiRootType RootType;
        [Header("UI摄像机")]
        public Camera UiCamera;
        [Header("UI层级配置信息")]
        public List<UILayoutConfigInfo> UiLayoutConfigList;

       


        /// <summary>
        /// 依据层级类型寻找UI展示的位置
        /// </summary>
        /// <param name="_type"></param>
        /// <returns></returns>
        public Transform GetLayout(UiLayoutType _type)
        {
            if (UiLayoutConfigList == null)
                return null;

            var config = UiLayoutConfigList.Find(_item => _item.UiLayout == _type);
            if (config == null)
            {
#if UNITY_EDITOR
                Debug.LogError($"未找到{_type.ToString()}层级配置信息");
#endif
                return null;
            }
            else
            {
                return config.RootTransform;
            }
              
        }

    }
}